package main

import (
	"github.com/spf13/pflag"
	"github.com/spf13/viper"
)

func main() {
	initViper()
	app := Init()
	for _, c := range app.Cousumers {
		err := c.Start()
		if err != nil {
			panic(err)
		}
	}
	go func() {
		app.adminServer.Start()
	}()
	err := app.Server.Serve()
	if err != nil {
		panic(err)
	}
}
func initViper() {
	cFile := pflag.String("config", "webook/interactive/config/dev.yaml", "指定配置文件路径")
	pflag.Parse()
	viper.SetConfigFile(*cFile)

	if err := viper.ReadInConfig(); err != nil {
		panic(err)
	}
}
